#ifndef __CLIENT_H__
#define __CLIENT_H__
#include "head.h"
#define SALT_LEN 8
typedef struct{
    char username[64];
    char passwd[128];
    //char homepath[256];//用户数据存储路径
    char path[128];//用于记录当前当前路径
}user_t,*puser_t;
typedef struct{
    int opt;//命令选项
    int len;//参数的长度
    char arg[128];
}optdata_t,*poptdata_t;//传递命令
typedef struct{
    int datalen;
    char buf[1024];
}train_t;
int client_init(int*,puser_t);
//用于tcp初始化，socket,bind,listen
int tcp_init(int*,char*,char*);
int rando(char*);//用于生成随机数
int enroll(int,puser_t);
int login(int,puser_t);
//获取终端发来的命令
//On success,the operator that indicate the operation is returned.
//On error,-1 is returned.
int get_command(puser_t,poptdata_t);
//执行命令，出错均返回-1
int do_command(int,optdata_t,puser_t);
int do_cd(int,optdata_t,puser_t);
int do_ls(int,optdata_t);
int do_puts(int,optdata_t);
int do_gets(int,optdata_t);
int do_remove(int,optdata_t);
int do_pwd(int,optdata_t);
int do_mkdir(int,optdata_t);
int trans_file(int,optdata_t);
int recv_file(int,char*);
//循环读取接受缓冲
int recvcycle(int,void*,int);
int md5sum(const char*,char*);
#endif
